var homePage = {

}


$(function () {
  // nav_menu height
  $('.nav_menu').css('height', $('.main').outerHeight(true) - 130);
  $('.header_navbar ul.nav>li').hover(function(){
    $(this).find('.nav_menu').show();
  },function(){
    $(this).find('.nav_menu').hide();
  })
  $('.nav_menu_c li a').click(function(){
    $('.nav_menu').hide();
    $('#menu_classify').show();
  })
  // notice
  var noticeNum = 0;
  function nextNotice() {
    noticeNum = noticeNum == $('.banner_message ul li').length - 1 ? 0 : (noticeNum + 1);
    carouselNotice();
  }
  function prevNotice() {
    noticeNum = noticeNum == 0 ? $('.banner_message ul li').length - 1 : (noticeNum - 1);
    carouselNotice();
  }
  function carouselNotice() {
    var topNum = -(($('.banner_message ul li').outerHeight(true)) * noticeNum);
    $('.banner_message ul').stop().animate({
      top: topNum
    }, 300);
  }
  var noticeLB = setInterval(nextNotice, 2000);

  // swiper
  var swiper = new Swiper('.swiper-container', {
    autoplay: 3000,
    speed: 1000,
    autoplayDisableOnInteraction: false,
    loop: true,
    centeredSlides: true,
    slidesPerView: 2.8,
    // pagination: '.swiper-pagination',
    paginationClickable: true,
    prevButton: '.swiper-button-prev',
    nextButton: '.swiper-button-next',
    onInit: function (swiper) {
      swiper.slides[2].className = "swiper-slide swiper-slide-active";//第一次打开不要动画
    },
    breakpoints: {
      668: {
        slidesPerView: 1,
      }
    }
  });
})
